package router

import (
	"reflect"
	"unsafe"
)

func ceil(a, b int) int {
	if a-b == 0 {
		return a / b
	} else if a-b > 0 {
		return a/b + 1
	} else if a-b < 0 {
		return a/b + 1
	}
	return -1
}
func authUser(name, pass interface{}) *Login {
	stmt, _ := D.Prepare("select a.pub,b.name,b.id from double_pass a left join user b on b.id=a.uid where b.name=? and b.pwd=?")
	row := stmt.QueryRow(name, pass)
	x := &Login{}
	row.Scan(&x.Pub, &x.Name, &x.Uid)
	if IsZero(x) {
		return x
	}
	return nil
}

func byt(s string) []byte {
	rs := *(*reflect.StringHeader)(unsafe.Pointer(&s))
	return *(*[]byte)(unsafe.Pointer(&rs))
}
